#!/usr/bin/python
# -*- coding:utf-8 -*-
# @author  : 孙国栋
# @time    : 2021/10/12 10:13
# @function: the script is used to do something.
# @version : 
#   V1
import json

from home.models import Article


def common_not(request):
    tay = Article.objects.values('tags','id').distinct().order_by('-total_views')[0:9]
    # 最新文章
    nwe = Article.objects.order_by('-create_time')[0:3]
    if 'login_name' in request.COOKIES:
        username = request.COOKIES.get('login_name')
        username = json.loads(username)

    else:
        username = ''
    return {'tay':tay,'nwe':nwe,'username':username}
